//
//  SectionrHeaderView.m
//  wedding
//
//  Created by 常宽 on 15/1/20.
//  Copyright (c) 2015年 常宽. All rights reserved.
//

#import "SectionrHeaderView.h"

@interface SectionrHeaderView ()
/// button
@property (nonatomic, retain)UIButton *more;
@end

@implementation SectionrHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        /// 标题
        self.title = [[UILabel alloc]init];
        [self addSubview:_title];
        
        /// button
        self.more = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//        [self addSubview:_more];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    /// 标题
    self.title.frame = CGRectMake(20, 0, self.frame.size.width * 0.7, self.frame.size.height);
    self.title.textColor = [WebColor crimson];
    self.title.font = [UIFont boldSystemFontOfSize:17.f];
    
    
    if ([self.title.text isEqualToString:@"推荐婚礼全程"] || [self.title.text isEqualToString:@"主题"] || [self.title.text isEqualToString:@"商品推荐"]) {
        
        /// 更多button
        self.more.frame = CGRectMake(self.frame.size.width * 0.7, 0, self.frame.size.width * 0.3, self.frame.size.height);
        [self.more setTitle:@"更多" forState:UIControlStateNormal];
        self.more.titleLabel.font = [UIFont boldSystemFontOfSize:10.f];
        [self.more setTitleColor:[WebColor crimson] forState:UIControlStateNormal];
        [self.more addTarget:self action:@selector(moreButton:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.more];
        
    }
    
}

- (void)moreButton:(UIButton *)sender
{
    NSLog(@"更多");
    self.tiaoZhuanBlock(self.title.text);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
